Repository navigation
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the proposal in #1246 by @CasperGN: re-issue
WaitForInstanceCompletionandWaitForInstanceStart(sync and async) when the server ends the wait call withgrpc.StatusCode.CANCELLEDand the caller's timeout has not expired.Problem
When
daprdshuts down or restarts mid-wait (e.g. rollouts, pod restarts, runtime reload), the actors router cancels all in-flight calls it tracks (dapr/dapr#10566). Previously, this causedwait_for_orchestration_completionandwait_for_orchestration_startto abort and raisegrpc.RpcError(StatusCode.CANCELLED)immediately, even though the workflow is intact and running on durable storage.Solution
CANCELLEDto_TRANSIENT_RPC_CODES:grpc.StatusCode.CANCELLEDto_TRANSIENT_RPC_CODESin bothTaskHubGrpcClient(dapr/ext/workflow/_durabletask/client.py) andAsyncTaskHubGrpcClient(dapr/ext/workflow/_durabletask/aio/client.py)._is_deadline_cancellation()maps deadline expiration to_TransientTimeout(TimeoutError), ensuring that caller-specified deadlines are never exceeded.timeout=0), when a healthy wait was in-flight and held bydaprdbefore being cancelled by a restart,transient_deadlineand backoff are refreshed, capped at_MAX_CONSECUTIVE_TRANSIENT_RESETS = 3to prevent infinite loops from persistent proxy idle timeouts or sidecar crash loops.CANCELLEDis re-raised immediately without retrying or invoking calls on the closed channel.is_closedproperty to both sync and asyncDaprWorkflowClient(and underlyingTaskHubGrpcClient/AsyncTaskHubGrpcClient) to inspect channel closure status.close(),aclose(), and async context manager (async with) support todapr.ext.workflow.aio.DaprWorkflowClient.with) support todapr.ext.workflow.DaprWorkflowClient.test_cancelled_within_deadline_still_propagates,test_cancelled_unbounded_wait_still_propagatesin sync and async) to verify thatCANCELLEDis absorbed, retried with backoff, and succeeds when the subsequent wait call returns the workflow state.grpc.RpcErroronce the grace window or consecutive reset cap elapses.is_closedand avoids re-invoking on closed channels.is_closed,close(),aclose(), and context manager lifecycles across sync and async publicDaprWorkflowClients.Issue reference
Please reference the issue this PR will close: Closes #1246
Checklist